package com.my.chapter5;

public class practice12 {
    public static void main(String[] args) {
        Tank t = new Tank(false);
        t.checkEmpty();
        new Tank(false);
        System.gc();
    }
}

class Tank{
    boolean checkedEmpty = false;
    public Tank(boolean checkedEmpty){
        this.checkedEmpty = checkedEmpty;
    }
    void checkEmpty(){
        checkedEmpty = true;
    }
    protected void finalize(){
        if(!checkedEmpty){
            System.out.println("Error：Tank is not Empty");
        }
    }
}

